:root {
    --game-zoom: 1;
}

body {
    margin: 0;
    overflow: hidden;
    background: #000;
}

.grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(to right, rgba(50, 50, 50, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(50, 50, 50, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    transform: scale(var(--game-zoom));
    transform-origin: center center;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    transform: scale(var(--game-zoom));
    transform-origin: center center;
    z-index: 1;
}

#score {
    position: fixed;
    top: 20px;
    left: 20px;
    color: white;
    font-family: Arial, sans-serif;
    font-size: 24px;
}

#player {
    width: 40px;
    height: 40px;
    position: absolute;
    border-radius: 50%;
    background: rgba(51, 51, 51, 0.3);
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    transition: width 0.3s ease, height 0.3s ease;
    transform-origin: center center;
}

.other-player {
    position: absolute;
    border-radius: 50%;
    background: rgba(51, 51, 51, 0.3);
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    transition: all 0.3s ease;
    pointer-events: none;
}

.nucleus-particle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    transform-origin: center center;
}

.nucleus-proton {
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #ff0000);
    box-shadow: 0 0 8px #ff0000;
}

.nucleus-neutron {
    background: radial-gradient(circle at 30% 30%, #6b8eff, #0044ff);
    box-shadow: 0 0 8px #0044ff;
}

.electron {
    width: 6px;
    height: 6px;
    position: absolute;
    background: radial-gradient(circle at 30% 30%, #ffffff, #a0a0a0);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    pointer-events: none;
    transform-origin: center center;
}

.electron-shell {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.electron:hover {
    animation-play-state: paused;
    filter: brightness(1.5);
}

.orbiting-electron {
    --orbit-radius: 30px;
    --orbit-speed: 4s;
    --start-angle: 0deg;
    --electron-offset-x: 0px;
    --electron-offset-y: 0px;
    position: absolute;
    animation: orbit var(--orbit-speed) linear infinite;
}

@keyframes orbit {
    from {
        transform: 
            rotate(var(--start-angle))
            translateX(var(--orbit-radius))
            rotate(calc(-1 * var(--start-angle)));
    }
    to {
        transform: 
            rotate(calc(var(--start-angle) + 360deg))
            translateX(var(--orbit-radius))
            rotate(calc(-1 * (var(--start-angle) + 360deg)));
    }
}

#evolve-button {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: linear-gradient(45deg, #4CAF50, #2196F3);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.3s ease;
}

#evolve-button.available {
    opacity: 1;
    pointer-events: auto;
    animation: pulse 2s infinite;
}

#evolve-button:hover {
    transform: scale(1.1);
}

#molecule-status {
    position: fixed;
    top: 60px;
    right: 20px;
    color: white;
    font-family: Arial, sans-serif;
    font-size: 16px;
    text-align: right;
}

.molecule-atom {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-family: Arial, sans-serif;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
}

.player-name {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-family: Arial, sans-serif;
    font-size: 14px;
    white-space: nowrap;
    pointer-events: none;
}

.chat-bubble {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    white-space: nowrap;
    max-width: 200px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.chat-bubble.visible {
    opacity: 1;
}

#chat-input {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    padding: 10px;
    border-radius: 20px;
    border: 2px solid #2196F3;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-family: Arial, sans-serif;
    display: none;
}

#chat-input.active {
    display: block;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}